home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
tcoop10a.zip
/
DOC.ZIP
/
RECT.DOC
< prev
next >
Wrap
Text File
|
1991-11-20
|
4KB
|
89 lines
RECT.DOC 11/15/91 Copyright (c) 1991 by James S. Clark
==========================================================================
RECT
Rectangle Class
--------------------------------------------------------------------------
Class Name Rect
Superclass <none>
Category Graphics
Other classes referenced Point
Other catagories referenced <none>
Used by <none>
Inherited by <none>
Declaration Rect *r = new Rect(x1, y1, x2, y2);
Instance Variables
Point upperleft;
Point lowerright;
Instance Methods
Rect (int x1 = 0, int y1 = 0,
int x2 = 0, int y2 = 0);
Rect (Point *ul, Point *lr);
Point extent ();
void inset (int , int );
void offset (int , int );
Point origin ();
void set (int , int , int , int );
operators Rect& operator = (const Rect& r);
Rect& operator + (const Rect& r);
--------------------------------------------------------------------------
GENERAL DESCRIPTION
Rect provides a class for working with rectangular areas of the screen.
Rectangles can be moved with the offset method, made bigger and smaller
with the inset method, copied with the = operator, and added by using the
+ operator.
--------------------------------------------------------------------------
VARIABLES
Point upperleft;
This is the upper left corner of the rectangle. It can be
accessed with the origin method.
Point lowerright;
This is the lower right corner of the rectangle. It can be
accessed with the extent method.
--------------------------------------------------------------------------
METHODS
Rect (int x1 = 0, int y1 = 0, int x2 = 0, int y2 = 0);
Create a new instance of a rectangle with the coordinates as given.
The default coordinates are (0, 0, 0, 0).
Rect (Point *ul, Point *lr);
Create a new instance of a rectangle with the corrdinates expressed
as two points.
Point extent ();
This method returns the lowerright Point of the rectangle.
void inset (int dx, int dy);
Inset will increase of decrease the size of a rectangle according
to the x and y delta values entered. Negative values will cause
the rectangle to get smaller.
void offset (int dx, int dy);
The offset method will cause the rectangles coordinates to be
shifted according to the x and y delta values entered. The effect
is that of adding the values to the rectangles x and y coordinates.
Point origin ();
The method returns the upperleft Point of the rectangle.
void set (int , int , int , int );
Set allows you the change the coordinates of an existing rectangle.
Rect& operator = (const Rect& r);
The = operator copies the contents of one rectangle into another.
Rect& operator + (const Rect& r);
The + operator adds the coordinates of one rectangle to another and
leaves the results in the rectangle on the left side of the +. The
effect is identical to the offset method.
--------------------------------------------------------------------------
RECT.DOC Copyright (c) 1991 by James S. Clark
==========================================================================